def triangles(num):
    n=0
    L = [1]
    while n<num:
        yield L
        #print(L)
        n+=1
        L =[1] + [L[i] + L[i+1] for i in range(len(L)-1)] + [1]
    return
g = triangles(8)
for x in g:
    print(x)
